<template>
  <div class="count">
    <h1>Count</h1>
    <h2>当前的num值是:{{$store.state.num}}</h2>
    <h2>当前的doubleNum值是:{{$store.state.doubleNum}}</h2>
 <div>
  <button @click="$store.commit('increment')">累加num-原始操作</button>
  <button @click="increment">累加num-封装操作</button>
  <button @click="$store.commit('incrementN',{n:2})">累加N----num-原始操作</button>
  <button @click="$store.incrementN('incrementN',{n:2})">累加N----num-封装操作</button>
 </div>
 </div>
</template>

<script>
import {mapMutations} from "vuex"
export default {
name:"Count",
mounted(){
    console.log(this);
},
methods:{
  ...mapMutations(["increment","incrementN"])
}
}
</script>

<style scoped>
.count{
    background: pink;
}
</style>